package com.example.learningspringboot.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.example.learningspringboot.pojo.*;

//标注为Java配置类
@Configuration
public class AppConfig {

    // @Bean表示将initUser()方法返回的对象装配到IoC容器中，该方法的属性name表示Bean的名称
    @Bean(name = "user")
    public User initUser() {
        var user = new User();
        user.setId(1L);
        user.setUserName("user_name_1");
        user.setNote("note_1");
        return user;
    }

}
